%section
  .index-banner.hidden-print.hidden-xs.hidden-sm
    = image_tag ufile_public_src_static('index_banner.png'), width: '100%', alt: '灰名单', title: '灰名单'
    .banner-search
      %form.form-inline.search-form{action:"#{search_credit_record_path}"}
        .form-group
          .input-group
            .input-group-addon
              %span.glyphicon.glyphicon-search{"aria-hidden" => "true"}
            %input.form-control.input-lg{:name => "citizen_id", :placeholder => "请输入您要查询的身份证", :type => "text", :value => ""}/
            .input-group-addon.btn.btn-danger.search-btn{style:'color: #fff;background-color: #d9534f;border-color: #d43f3a;'}
              查询
  .hidden-md.hidden-lg
    .banner-search
      %form.form-inline.search-form{action:"#{search_credit_record_path}"}
        .form-group
          .input-group
            .input-group-addon
              %span.glyphicon.glyphicon-search{"aria-hidden" => "true"}
            %input.form-control.input-lg{:name => "citizen_id", :placeholder => "请输入您要查询的身份证", :type => "text", :value => ""}/
            .input-group-addon.btn.btn-danger.search-btn{style:'color: #fff;background-color: #d9534f;border-color: #d43f3a;'}
              查询
  .index-news
    .news-hd
      %h3 公共信息
      %a{href: "#{list_article_path}"}
        更多
        %i.glyphicon.glyphicon-plus
    .news-bd
      .container-fluid
        .row
          - @articles.each_with_index do |article, index|
            - _hidden_class = index > 4 ? " hidden-sm hidden-xs " : ""
            .col-md-4{class: "#{_hidden_class}"}
              %span
                %i.glyphicon.glyphicon-triangle-top{style:'color:#be332e'}
                %h5{style:'display: inline-block;'}= link_to article.title_ellipsis, show_article_path(article.id)
            
  
  %hr{style:'height:3px;background-color: #999;'}
  - if current_user
    .index-forms
      .container-fluid
        .row
          %ul.nav.nav-tabs{:role => "tablist"}
            %li.active{:role => "presentation"}
              %a{"aria-controls" => "rental", "data-toggle" => "tab", :href => "#rental", :role => "tab"} 租车灰名单上报
            %li{:role => "presentation"}
              %a{"aria-controls" => "credit", "data-toggle" => "tab", :href => "#credit", :role => "tab"} 信贷灰名单上报
            %li{:role => "presentation"}
              %a{"aria-controls" => "other", "data-toggle" => "tab", :href => "#other", :role => "tab"} 其他灰名单上报
      .tab-content
        #rental.tab-pane.fade.in.active{:role => "tabpanel"}
          #evidence-form
            #error-notice
            = form_tag credit_record_report_path,id: 'new_profile',class: 'form-horizontal', multipart: true, method: :post do
              = hidden_field_tag 'credit_record[industry]', nil, class: "form-control", placeholder: "请填写行业分类", value: "租车"
              -#
              =# form_for @credit_record, remote: true, html: {class: 'form-inline',style: 'border-bottom:1px #eee solid;padding-bottom:15px;margin-bottom:15px;'} do |f|
              -# if @credit_record.errors.any?
                #error_explanation
                  %h2
                    有
                    = pluralize(@credit_record.errors.count, "个输入错误")
                    ，无法提交:
                  %ul
                    - @credit_record.errors.full_messages.each do |message|
                      %li= message
              - if alert
                %p.alert.alert-danger{role:"alert"}= alert
              .container-fluid{style: "padding:0"}
                .col-sm-6
                  .form-group
                    %label.col-sm-4.control-label
                      %span{style: 'color: red;'} *
                      被举报人姓名
                    .col-sm-8
                      = text_field_tag 'credit_record[person_reported_against]', nil, class: "form-control", placeholder: "请填写被举报人姓名"
                .col-sm-6
                  .form-group
                    %label.col-sm-4.control-label
                      %span{style: 'color: red;'} *
                      被举报人身份证号
                    .col-sm-8
                      = text_field_tag 'credit_record[citizen_id]', nil, class: "form-control", placeholder: "请填写被举报人身份证号（15-18位）", value: params[:citizen_id]
                .col-sm-6
                  .form-group
                    %label.col-sm-4.control-label
                      %span{style: 'color: red;'} *
                      案发地址
                    .col-sm-8
                      = text_field_tag 'credit_record[address]', nil, class: "form-control", placeholder: "请填写地址"
                .col-sm-6
                  .form-group
                    %label.col-sm-4.control-label
                      %span{style: 'color: red;'} *
                      举报原因
                    .col-sm-8
                      %select.form-control#reported-reason-selector
                        %option{value:"骗车抵押"} 骗车抵押
                        %option{value:"拖欠资金"} 拖欠资金
                        %option{value:"信用不良"} 信用不良
                        %option{value:"伪造证件"} 伪造证件
                        %option{value:"违章不处理"} 违章不处理
                        %option{value:"警方提供"} 警方提供
                        %option{value:"其它"} 其它


                      =# text_field_tag 'credit_record[reported_reason]', nil, class: "form-control", placeholder: "请填写举报原因"
                .col-sm-6
                  .form-group
                    %label.col-sm-4.control-label
                      %span{style: 'color: red;'} *
                      案发时间
                    .col-sm-8
                      = text_field_tag 'credit_record[time_of_incident]', nil, class: "form-control", id: "incident-daypicker"

                .col-sm-6#reported-reason-other.hidden
                  .form-group
                    %label.col-sm-4.control-label 填写举报原因
                    .col-sm-8
                      = text_field_tag 'credit_record[reported_reason]', nil, class: "form-control", id: "reported_reason", placeholder: "请填写地址", value: '骗车抵押'

                .col-sm-12
                  .alert.alert-info{role: "alert",style: "margin-top:20px"}
                    %strong 提示：
                    请在上传证据中包含被举报人的身份证照片！
                
                .col-sm-12#upload-pic1
                  .upload-div
                    %span.glyphicon.glyphicon-plus
                    .upload-text 上传被举报人身份证
                    %input.hidden{:name => "files[]", :type => "file"}
                    .upload-bd
                .col-sm-12#upload-pic2
                  .upload-div
                    %span.glyphicon.glyphicon-plus
                    .upload-text 上传合同文件
                    %input.hidden{:name => "files[]", :type => "file"}
                    .upload-bd
                .col-sm-12#upload-pic3
                  .upload-div
                    %span.glyphicon.glyphicon-plus
                    .upload-text 上传其他证据
                    %input.hidden{:name => "files[]", :type => "file"}
                    .upload-bd
                - if current_user.new?
                  .col-sm-12
                    .alert.alert-info{role: "alert",style: "margin-top:20px"}
                      %strong 提示：
                      您的账号尚未认证,请填写认证信息！
                  .col-sm-6
                    .form-group
                      %label.col-sm-4.control-label
                        %span{style: 'color: red;'} *
                        我的真实姓名
                      .col-sm-8
                        = text_field_tag 'user[realname]', current_user.realname, class: 'form-control', placeholder: "请填写姓名"
                  .col-sm-6
                    .form-group
                      %label.col-sm-4.control-label
                        %span{style: 'color: red;'} *
                        我的身份证号
                      .col-sm-8
                        = text_field_tag 'user[citizen_id]', current_user.citizen_id, class: 'form-control', placeholder: "请填写身份证号"
                  .col-sm-6
                    .form-group
                      %label.col-sm-4.control-label
                        %span{style: 'color: red;'} *
                        我的公司名称
                      .col-sm-8
                        = text_field_tag 'user[company_name]', current_user.company_name, class: 'form-control', placeholder: "请填写公司名称"
                  .col-sm-6
                    .form-group
                      %label.col-sm-4.control-label
                        %span{style: 'color: red;'} *
                        我司车辆数
                      .col-sm-8
                        = text_field_tag 'user[car_number]', current_user.car_number, class: 'form-control', placeholder: "请填写车辆数"
                  .col-sm-6
                    .col-sm-12
                      .form-group
                        .citizen-card-front{style: "margin:0"}
                          %span.glyphicon.glyphicon-plus
                          .upload-text 我的身份证正面（照片）
                          = file_field_tag 'user[picture_citizen_card_front]', class: 'hidden'
                          .upload-bd
                  .col-sm-6
                    .col-sm-12
                      .form-group
                        .citizen-card-back{style: "margin:0"}
                          %span.glyphicon.glyphicon-plus
                          .upload-text 我的身份证反面（照片）
                          = file_field_tag 'user[picture_citizen_card_back]', class: 'hidden'
                          .upload-bd
                  .col-sm-6
                    .col-sm-12
                      .form-group
                        .business-license{style: "margin:0"}
                          %span.glyphicon.glyphicon-plus
                          .upload-text 我公司营业执照（照片）
                          = file_field_tag 'user[picture_business_license]', class: 'hidden'
                          .upload-bd
              .actions
                %input.btn.btn-default{type:'submit',value: '举报'}
        #credit.tab-pane.fade{:role => "tabpanel"}
          %div{style: 'width:100%;height:auto;text-align:center;overflow:hidden;'}
            .btn.btn-default.btn-lg.yc-btn-nologin{style: 'height:auto;background:#fff;color:#555;'}
              %i.glyphicon.glyphicon-hand-up
              敬请期待
        #other.tab-pane.fade{:role => "tabpanel"}
          %div{style: 'width:100%;text-align:center;overflow:hidden;'}
            .btn.btn-default.btn-lg.yc-btn-nologin{style: 'height:auto;background:#fff;color:#555;'}
              %i.glyphicon.glyphicon-hand-up
              敬请期待
      -#else
        #rental.tab-pane.fade.in.active{:role => "tabpanel"}
        #credit.tab-pane.fade{:role => "tabpanel"}
          %p 1
          %p 22
          %p 3
          %p 4
        #other.tab-pane.fade{:role => "tabpanel"}
          %p 1
          %p 2
          %p 33
          %p 4
  - else
    %div{style: 'width:100%;text-align:center;overflow:hidden;'}
      %a.btn.btn-danger.btn-lg.yc-btn-nologin{href: "#{new_user_session_path}", style:'font-size:24px'}
        %i.glyphicon.glyphicon-hand-up
        我要举报
  %div{style: 'width:144px;overflow:hidden;position:fixed;margin-left:1140px;bottom:100px;'}
    -# - if Rails.env == 'development'
    -#   = image_tag ufile_public_src_static( 'app_qr.png' ), width: '144', alt: '灰名单二维码', title: '灰名单二维码'
    -#   = image_tag ufile_public_src_static( 'app_qr.png' ), width: '144', alt: '灰名单二维码', title: '灰名单二维码'
    -# - else
    - @config_app_qr = Config.where(name: 'app_qr').take
    - @config_weixin_ar = Config.where(name: 'weixin_qr').take
    = image_tag @config_weixin_ar.file.url, width: '144', alt: '灰名单微信二维码', title: '灰名单微信二维码'
    = image_tag @config_app_qr.file.url, width: '144', alt: '灰名单APP二维码', title: '灰名单APP二维码'


= javascript_include_tag '//cdn.bootcss.com/moment.js/2.10.6/moment.min.js'
= javascript_include_tag '//cdn.bootcss.com/moment.js/2.10.6/locale/zh-cn.js'
=# stylesheet_link_tag     '//ycpublic.oss-cn-beijing.aliyuncs.com/static/bootstrap-datetimepicker.css'
=# javascript_include_tag     '//ycpublic.oss-cn-beijing.aliyuncs.com/static/bootstrap-datetimepicker.min.js'
= stylesheet_link_tag     '//cdn.bootcss.com/bootstrap-datetimepicker/4.17.37/css/bootstrap-datetimepicker.min.css'
= javascript_include_tag "//cdn.bootcss.com/bootstrap-datetimepicker/4.17.37/js/bootstrap-datetimepicker.min.js"
:javascript
  $('#incident-daypicker').datetimepicker({
    format: 'YYYY-MM-DD',
    viewMode: 'days'
  });
  $('#incident-daypicker').click(function(){
    $('.icon-arrow-left').addClass('glyphicon glyphicon-chevron-left')
    $('.icon-arrow-right').addClass('glyphicon glyphicon-chevron-right')
  });
  $('.search-btn').click(function(){
    $(this).parentsUntil('.search-form').parent().submit()
  })

